#include <iostream>
#include <fstream>
#include <string>

using namespace std;

int main() {
    int ans = 0;
    ifstream file {"89.txt"};
    string line;
    while (getline(file, line)) {
        if (string::npos != line.find("DCCCC"))
            ans += 3;
        else if (string::npos != line.find("CCCC"))
            ans += 2;

        if (string::npos != line.find("LXXXX"))
            ans += 3;
        else if (string::npos != line.find("XXXX"))
            ans += 2;

        if (string::npos != line.find("VIIII"))
            ans += 3;
        else if (string::npos != line.find("IIII"))
            ans += 2;
    }
    cout << ans << endl;
    file.close();
}